from django.shortcuts import get_object_or_404, render, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, loader
from django.views import generic
from django.core.urlresolvers import reverse

from control.models import Item

# Create your views here.
def home(request):
    return render_to_response('home.html')

def index(request):
    items = Item.objects.order_by('stock')
    template = loader.get_template('control/index.html')
    context = RequestContext(request, {'items':items})
    return HttpResponse(template.render(context))
                        
'''class IndexView(generic.TemplateView):
    template_name = 'control/index.html'
    context_object_name = 'client_list'

    def get_queryset(self):
        clients = Client.objects.order_by('name')
        response = HttpResponse('')
        response['By-Name'] = clients
        return response
'''
